package com.antwork.common.dao;

import java.util.HashMap;

public class DynamicSqlParameter extends HashMap<String, Object> {
	private static final long serialVersionUID = 1L;
	private HashMap<String, Object> updateValueList;
	private String dbDialect;
	private String sqlId;
	private String paginationSqlId;
	private String paginationCountSqlId;
	private int paginationCurrent = 1;
	private int paginationSize = 1;
	private int paginationStart;
	private int paginationOffset;

	public String getDbDialect() {
		return this.dbDialect;
	}

	public void setDbDialect(String dbDialect) {
		this.dbDialect = dbDialect;
	}

	public void addUpdateValue(String key, Object value) {
		if (this.updateValueList == null) {
			this.updateValueList = new HashMap();
		}
		this.updateValueList.put(key, value);
	}

	public HashMap<String, Object> getUpdateValueList() {
		return this.updateValueList;
	}

	public String getSqlId() {
		return this.sqlId;
	}

	public void setSqlId(String sqlId) {
		this.sqlId = sqlId;
	}

	public String getPaginationSqlId() {
		return this.paginationSqlId;
	}

	public void setPaginationSqlId(String paginationSqlId) {
		this.paginationSqlId = paginationSqlId;
	}

	public String getPaginationCountSqlId() {
		return this.paginationCountSqlId;
	}

	public void setPaginationCountSqlId(String paginationCountSqlId) {
		this.paginationCountSqlId = paginationCountSqlId;
	}

	public int getPaginationCurrent() {
		return this.paginationCurrent;
	}

	public void setPaginationCurrent(int paginationCurrent) {
		this.paginationCurrent = paginationCurrent;
	}

	public int getPaginationSize() {
		return this.paginationSize;
	}

	public void setPaginationSize(int paginationSize) {
		this.paginationSize = paginationSize;
	}

	public int getPaginationStart() {
		return this.paginationStart;
	}

	public void setPaginationStart(int paginationStart) {
		this.paginationStart = paginationStart;
	}

	public int getPaginationOffset() {
		return this.paginationOffset;
	}

	public void setPaginationOffset(int paginationOffset) {
		this.paginationOffset = paginationOffset;
	}

	public void setPagination(int currentPage, int pageSize) {
		this.paginationCurrent = currentPage;
		this.paginationStart = ((currentPage - 1) * pageSize);
		this.paginationOffset = pageSize;
		this.paginationSize = pageSize;
		put("start", Integer.valueOf(this.paginationStart));
		put("offset", Integer.valueOf(this.paginationOffset));
	}
}